Gravity Mouse Chaser
Chris MacGregor for MacGregor Media - chris@macgregor.net


This is a very cool effect that we are starting to see a lot in Flash.  It's limitations are endless.  Below you will see how to add gravity to Flash using a mouse chaser.  The spinner follows your mouse according to how fast your move your mouse in a direction.  Very cool!

TUTORIAL
 
Note:  Since this is an advanced tutorial, there won't be many screenshots, as you should already know how to do most of the work.  This lesson will provide you with the code you need to know and the concept to make gravity work.

Screenshot of the frames you will be creating in this tutorial:

  1. Create a new movie in Flash
     
  2. Create a new button symbol (insert > new symbol) Call this button Drag.
     
  3. In the hit, or fourth frame, of the button image draw a small circle. It should be centered at the middle of the button.
     
  4. In the first frame of the main scene, place this button in the middle of the scene. Because there is nothing on the Up, Over or Down frames of the button, Flash will display this button as a shaded object.
     
  5. With the button selected, convert it to a movie clip symbol (insert > convert to symbol) name the symbol drg1.
     
  6. Give the symbol an instance name (modify > instance) (I named mine drg1).
     
  7. Create an action for the frame with the script: Start Drag ("/drg1", lockcenter). This centers the invisible button at the center of the mouse when the movie starts playing.
     
  8. Create a new layer, let's call it 'Spinner'.
     
  9. Create the symbol that you wish to react to the mouse in the third frame of this layer. For this tutorial I have made the pin-wheel spinner. I called it Spinner.
     
  10. Give the symbol an instance name (modify > instance) (I named mine spin1).
     
  11. Create a new layer, let's call it 'Action Layer'.
     
  12. In the third frame of the Action Layer, create a new Movie Clip Symbol (insert > new symbol). Name this movie clip 'action'.
     
  13. Open this Movie Clip for editing. Create an action in the first frame.
  14. Add a second layer to the action movie clip, and a second frame to both layers.
     
  15. Insert a blank key frame in the second frame of the second layer.
     
  16. Either repeat all the scripting from step 13, or copy the actions from the first frame of the first layer (where all that scripting went) and paste it into the second frame of the second layer (edit > copy frames) then (edit > paste frames).
    Here is a screen shot of the Action movie clip:

     
  17. Return to the main scene and add a stop action to the third frame on the Action Layer. Make sure that your Action movie clip is in the third frame of this scene.
     
  18. Test your movie.

©1999 Chris MacGregor for MacGregor Media - chris@macgregor.net

 


© Copyright 1999,2000 Virtual-FX. All rights reserved. Last updated Friday, April 28, 2000  --  Read our Privacy Policy
 
Contact Us:

But PLEASE! No emails requesting help with Flash. Use the messageboard

amanda@virtual-fx.net
patrick@virtual-fx.net

 

 
Link to us:

http://www.virtual-fx.net/
Join our mailing list!
Enter your email address below,
then click the 'Join List' button:


Subscribe Unsubscribe
Powered by ListBot